import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { UrlService } from '../../../providers/url-service';

@Component({
  selector: 'page-challenge-detial-one-end',
  templateUrl: 'challenge-detial-one-end.html',
})
export class ChallengeDetialOneEndPage {
  ChallengeDetialID;
  constructor(
    public navCtrl: NavController,
    public urlService: UrlService,
    public navParams: NavParams) {

    this.ChallengeDetialID = navParams.get("ChallengeDetialID");
    console.log(this.ChallengeDetialID);
    this.GetDekaronInfo(this.ChallengeDetialID);
  }
  ionViewDidLoad() {
    console.log('单个挑战  ChallengeDetialTwoStartPage');
  }
  pageData = [];
  pageDataIsok = false;
  /**
   * 获取详情
   */
  GetDekaronInfo(item) {
    // item.DekaronID ="6B11D20F-9C03-415F-92A5-9D2F22A6C339";
    this.urlService.GetDekaronInfo(item.DekaronID)
      .then(msg => {
        if (msg.Code == 0) {
          this.pageDataIsok = true;
          this.pageData[0] = msg.Data;
        }
      })
  }

  showMoreActionFlag = false;
  /**
   * 打开分享
   */
  showMoreActionModal() {
    this.showMoreActionFlag = true
  }
  /**
   * 取消分享
   */
  hideMoreActionModal() {
    this.showMoreActionFlag = false
  }

	/**
   * 下拉刷新
   * @param refresher 
   */
  doRefresh(refresher) {
    setTimeout(() => {
      this.GetDekaronInfo(this.ChallengeDetialID);
      refresher.complete();
    }, 2000);
  }
}
